82a8f5a8e9a0c82d0f6a058de33a46d2c29fecff,rx_paparazzo/src/main/java/com/fuck_boilerplate/rx_paparazzo/interactors/DownloadImage.java,DownloadImage,downloadFile,#,76

Before Change


        Context context = targetUi.getContext();
        File dir = new File(context.getFilesDir(), Constants.SUBDIR);
        dir.mkdirs();
        File file = new File(dir, uri.getLastPathSegment() + ".tmp");
        imageUtils.copy(inputStream, file);
        return file.getAbsolutePath();
    }

After Change


        URLConnection connection = url.openConnection();
        connection.connect();
        InputStream inputStream = new BufferedInputStream(url.openStream(), 1024);
        String filename = uri.getLastPathSegment();
        filename += imageUtils.getFileExtension(filename);
        File file = imageUtils.getPrivateFile(filename);
        imageUtils.copy(inputStream, file);